package com.erebus.feignclient;

import com.erebus.model.dto.Cart;
import com.taobao.base.model.RestResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;


@Slf4j
@Component
public class ShopCartClientFactory implements FallbackFactory<ShopCartClient> {

    @Override
    public ShopCartClient create(Throwable throwable) {
        return new ShopCartClient() {


            @Override
            public RestResponse<List<Cart>> getCart(int userId) {
                log.error("调用shopcart-api服务失败", throwable);
                return null;
            }

            @Override
            public void test() {

            }
        };
    }
}
